﻿namespace Samples.Explorer
{
    using System;
    using System.Reflection;
    using System.Web.Hosting;
    using System.Web.Mvc;
    using System.Web.Routing;

    using Samples.Explorer.Controllers.Explorer;

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.IgnoreRoute("favicon.ico");

            routes.MapRoute("Explorer", "{filter}", new { controller = "explorer", action = "index", filter = EntrySource.Merged });
        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }
    }
}